package org.bite.lesson06;

public class SingletonLazy {
//    private static SingletonLazy instance = null;
//    private SingletonLazy() {};
//    public static SingletonLazy getInstance() {
//        synchronized (SingletonLazy.class){
//            if(instance == null){
//                instance = new SingletonLazy();
//            }
//        }
//        return instance;
//    }
    /**
     * 11.24复习，再写一遍
     * 懒汉模式，类加载的时候不new对象
     */
    private static SingletonLazy instance = null;
    private SingletonLazy(){};
    public static SingletonLazy getInstance(){
        if(instance == null){
            instance = new SingletonLazy();
        }
        return instance;
    }
}
